const notFind = () => import(/*webpackChunkName: "404" */'pages/404/404')
const home = () => import(/*webpackChunkName: "home" */'pages/home/home')
const login = () => import(/*webpackChunkName: "login" */'pages/login/login')
const register = () => import(/*webpackChunkName: "register" */'pages/register/register')
const cart = () => import(/*webpackChunkName: "cart" */'pages/cart/cart')
const order = () => import(/*webpackChunkName: "order" */'pages/order/order')
const search = () => import(/*webpackChunkName: "search" */'pages/search/search')
const detail = () => import(/*webpackChunkName: "detail" */'pages/detail/detail.vue')
const info =
    () => import(/* webpackChunkName: "detail-info" */"pages/detail/info/info.vue")
const rule =
    () => import(/* webpackChunkName: "detail-rule" */"pages/detail/rule/rule.vue")
const after =
    () => import(/* webpackChunkName: "detail-after" */"pages/detail/after/after.vue")
const ratings =
    () => import(/* webpackChunkName: "detail-ratings" */"pages/detail/ratings/ratings.vue")
const phone =
    () => import(/* webpackChunkName: "detail-phone" */"pages/detail/phone/phone.vue")
const addCartSuccess =
    () => import(/* webpackChunkName: "addCartSuccess" */"pages/addCartSuccess/addCartSuccess")
const trade = () => import(/*webpackChunkName: "trade" */'pages/trade/trade.vue')
const pay =
    () => import(/* webpackChunkName: "sph-pay" */"pages/pay/pay.vue")
const paySuccess =
    () => import(/* webpackChunkName: "sph-pay" */"pages/paySuccess/paySuccess.vue")
const center =
    () => import(/* webpackChunkName: "sph-center" */"pages/center/center.vue")
const myOrder =
    () => import(/* webpackChunkName: "sph-center" */"pages/center/myOrder/myOrder.vue")
export default [
    {
        name: "paySuccess",
        path: "/paySuccess",
        component: paySuccess
    },
    {
        name: "pay",
        path: "/pay",
        component: pay,
        props: route => ({
            orderId: route.query.orderId
        })
    },
    {
        name: "center",
        path: "/center",
        component: center,
        children: [
            { name: "center-myOrder", path: "myOrder", component: myOrder },
            { path: "", redirect: "myOrder" }
        ]
    },
    { name: 'trade', path: '/trade', component: trade },
    {
        name: 'addCartSuccess',
        path: '/addcartsuccess',
        component: addCartSuccess,
        props: route => ({
            num: route.query.num
        })
    },

    {
        name: 'detail',
        path: '/detail/:id',
        component: detail,
        props: true,
        children: [
            { name: "detail-info", path: "info", component: info },
            { name: "detail-rule", path: "rule", component: rule },
            { name: "detail-after", path: "after", component: after },
            { name: "detail-ratings", path: "ratings", component: ratings },
            { name: "detail-phone", path: "phone", component: phone },
            { path: "", redirect: "info" },
        ]
    },

    { name: "order", path: "/order", component: order },
    { name: "cart", path: "/cart", component: cart },
    {
        name: "search",
        path: "/search/:keyword?",
        component: search,
        props: $route => ({
            keyword: $route.params.keyword,
            category1Id: $route.query.category1Id,
            category2Id: $route.query.category2Id,
            category3Id: $route.query.category3Id,
            categoryName: $route.query.categoryName
        })
    },
    {
        name: "login",
        path: "/login",
        component: login,
        meta: {
            hideFooter: true
        }
    },
    {
        name: "register",
        path: "/register",
        component: register,
        meta: {
            hideFooter: true
        }
    },
    { name: 'home', path: '/home', component: home, meta: { showFirstList: true } },
    { path: "/", redirect: "/home" },
    {
        name: '404', path: '/404',
        component: notFind,
        meta: {
            hideFooter: true,
            hideHeader: true
        }
    },
    { path: "*", redirect: "/404" }
]